<?php 
/**
 * 类型属性表
 */
 class TypeattrModel extends Model{
 	public $table = "typeattr";
	
	public $validate = array(
		array('attrname','nonull','属性名不能为空',2,3),
		array('attrval','nonull','属性值不能为空',2,3),
	);
	//添加属性
	public function addData(){
	    //create 触发自动验证
		if(!$this->create()) return false;
		return $this->add();
	}
	//编辑属性
	public function editData($id){
	     //create 触发自动验证
		if(!$this->create()) return false;
		return $this->where("attrid=$id")->update();
	}
 }
